/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.com.dizucar.controlador;

import javax.persistence.EntityManager;
import javax.persistence.Query;
import sv.com.dizucar.modelo.DetalleVenta;

/**
 *
 * @author stefanny
 */
public class DetalleVentaControlador extends ControladorAbstracto<DetalleVenta> {

    public DetalleVentaControlador() {
        super(DetalleVenta.class);
    }

    
    
    @Override
    protected EntityManager getEntityManager() {
        return Conexion.getEntityManager();
    }
    
    
    public Integer obtenerSiguienteID(){
        try{
            Query q = getEntityManager().createQuery("select max(o.iddetalleventa) from DetalleVenta o");
            return (Integer) q.getSingleResult() + 1;
        }catch(Exception e){
            e.printStackTrace();
            return 1;
        }
    }
}
